home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-09-30 | 5.3 KB | 208 lines | [TEXT/CWIE] |
- // COPYRIGHT 1995 A.D. Software, All rights reserved
-
- // Public interface of PowerPlant Integration layer of OOFILE database
-
- #ifndef H_OOFPowerPlant
- #define H_OOFPowerPlant
-
- // COPYRIGHT 1995 A.D. Software, All rights reserved
-
- // PowerPlant Integration layer of OOFILE database
-
- // NOTE inline definitions included at end of this header file
- #include "oof0.hpp"
-
- // include PowerPlant definitions
-
- #include <PP_Types.h>
- const MessageT cmd_dbFirst = 'dFst'; // 1682338676
- const MessageT cmd_dbPrev = 'dPrv'; // 1682993782
- const MessageT cmd_dbNext = 'dNxt'; // 1682864244
- const MessageT cmd_dbLast = 'dLst'; // 1682731892
-
- const MessageT cmd_dbNew = 'dNew'; // 1682859383
- const MessageT cmd_dbEdit = 'dEdt'; // 1682269300
- const MessageT cmd_dbView = 'dVuw'; // 1683387767
- const MessageT cmd_dbDel = 'dDel'; // 1682204012
- const MessageT cmd_dbDoubleClick = 'd2Cl'; // 1681015660
-
- // forward declarations of PowerPlant classes to avoid including
- class LEditField;
- class LTextEdit;
- class LCommander;
- class LWindow;
- class LListBox;
-
- // family of abstract link classes
- // this is a somewhat messy collection and probably cries out to be
- // templated - hey, it's a first cut!
-
- // head of family of abstract link classes
- // rest are declared in oofppx.hpp
-
-
- class dbFieldLink : public dbClass {
- private:
- dbFieldLink() {};
-
- public:
- virtual void copyFieldToLink()=0;
- virtual void copyLinkToField()=0;
- };
-
-
- class dbTable;
-
- class dbWindowFactory {
- public:
- dbWindowFactory(LCommander* C, dbTable* T) : mCommander(C), mTable(T) {};
- virtual ~dbWindowFactory() {};
- virtual LWindow* makeWindow(const bool loadData=true) const=0;
- dbTable* mainTable();
-
- protected:
- LCommander* mCommander;
- dbTable* mTable;
- };
-
-
- class dbChar;
- class dbText;
- class dbLong;
- class dbShort;
- class dbDate;
- class dbReal;
- class dbDocHelper;
- class dbView;
- class dbBrowserDisplay;
-
- class dbWindowHelper {
- protected:
- dbWindowHelper();
- virtual ~dbWindowHelper() {};
-
- public:
- virtual void recordHasBeenChanged(dbWindowHelper* changedBy) {};
-
- protected:
- void LinkToDoc();
- dbDocHelper* mBossDoc;
- };
-
-
- class dbBrowseHelper : public dbWindowHelper {
- protected: // can't create as other than mixin
- dbBrowseHelper();
- virtual ~dbBrowseHelper();
-
- public:
- virtual void recordHasBeenChanged(dbWindowHelper* changedBy);
-
- protected:
- bool OOFILEhandlesMessage(const Int32 inMessage, void *ioParam);
- void DelRecord();
- void AdoptView(dbView*);
- void BrowseViewWithListBox(LListBox*);
- void LoadBrowseData();
-
- private:
- dbView* mBrowsingView; // adopted
- dbBrowserDisplay* mBrowserDisplay; // owned
- };
-
-
- class dbEditHelper : public dbWindowHelper {
- protected: // can't create as other than mixin
- dbEditHelper();
- virtual ~dbEditHelper();
-
- // USER-HOOKS override the following virtual methods as documented in guihooks.txt
- virtual void EnteringAboutToLoad() {};
- virtual void EnteringAfterLoad() {};
- virtual bool CanLeaveRecord() { return true; };
- virtual void LeavingAboutToSave() {};
- virtual void LeavingAfterSave() {};
-
- void LoadData();
- void SaveRecord();
- void GoFirstRecord();
- void GoNextRecord();
- void GoPrevRecord();
- void GoLastRecord();
- void LinkField(dbChar&, LEditField*);
- void LinkField(dbChar*, LEditField*);
- void LinkField(dbChar&, LTextEdit*);
- void LinkField(dbChar*, LTextEdit*);
- void LinkField(dbText&, LTextEdit*);
- void LinkField(dbText*, LTextEdit*);
- void LinkField(dbLong&, LEditField*);
- void LinkField(dbLong*, LEditField*);
- void LinkField(dbShort&, LEditField*);
- void LinkField(dbShort*, LEditField*);
- void LinkField(dbDate&, LEditField*);
- void LinkField(dbDate*, LEditField*);
-
- bool OOFILEhandlesMessage(const Int32 inMessage, void *ioParam);
- bool LeaveRecord();
- void CopyLinksToFields();
- void CopyFieldsToLinks();
-
- // data storage
- bool mChangingPages, mNew, mAutoSaveOnMoving;
- dbTable* mMainTable; // owned smart pointer
- OOF_Dictionary mLinks;
- // copies of what are probably members of the subclass used to manage the output
- // list or other database front-end. We need these so we can provide default
- // behaviour here in the mixin, that can be overridden if absolutely needed
- // but is useful from day one
-
-
- public:
- static void warnUser(ostream& os);
- };
-
-
- class dbDocHelper {
- protected: // can't create as other than mixin
- dbDocHelper();
- virtual ~dbDocHelper();
-
- public:
- void recordHasBeenChanged(dbWindowHelper* changedBy); // the Doc will decide if it tells anyone else
- void interestedInRecordChanges(dbWindowHelper*);
-
- protected:
- void AdoptAddDialogFactory(dbWindowFactory*);
- void AdoptEditDialogFactory(dbWindowFactory*);
- void AdoptBrowseWindowFactory(dbWindowFactory*);
- bool OOFILEhandlesMessage(const Int32 inMessage, void *ioParam);
- // the next 3 methods can return NULL if no factory attached
- LWindow* MakeBrowser();
- LWindow* NewRecord();
- LWindow* MakeEditor();
-
- protected:
- dbTable* mMainTable;
-
- private:
- dbWindowFactory* mAddFactory; // owned
- dbWindowFactory* mEditFactory; // owned
- dbWindowFactory* mBrowseFactory; // owned
- dbWindowHelper* mInterestedInRecordChanges; // will later be a list
- static dbDocHelper* sCurrentDoc;
-
-
- friend bool dbBrowseHelper::OOFILEhandlesMessage(const Int32 inMessage, void *ioParam);
- friend bool dbEditHelper::OOFILEhandlesMessage(const Int32 inMessage, void *ioParam);
- friend void dbWindowHelper::LinkToDoc();
- };
-
-
-
-
-
-
-
- #include "oofpp.inl"
- #endif
-